<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/TR/REC-html40" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml"><head>



<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 10">
<meta name="Originator" content="Microsoft Word 10">
<link rel="File-List" href="http://uva.onlinejudge.org/external/103/p12_files/filelist.xml">
<link rel="Edit-Time-Data" href="http://uva.onlinejudge.org/external/103/p12_files/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Problem M - GWCF Contest 4 - The Decider</title>
<o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"></o:smarttagtype>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Shahriar Manzoor</o:Author>
  <o:LastAuthor>Shahriar Manzoor</o:LastAuthor>
  <o:Revision>178</o:Revision>
  <o:TotalTime>1563</o:TotalTime>
  <o:LastPrinted>2002-06-17T05:30:00Z</o:LastPrinted>
  <o:Created>2000-12-04T12:45:00Z</o:Created>
  <o:LastSaved>2002-06-28T09:33:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>259</o:Words>
  <o:Characters>1478</o:Characters>
  <o:Company>CSE, BUET</o:Company>
  <o:Lines>12</o:Lines>
  <o:Paragraphs>3</o:Paragraphs>
  <o:CharactersWithSpaces>1734</o:CharactersWithSpaces>
  <o:Version>10.2625</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Print</w:View>
  <w:Zoom>90</w:Zoom>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
  <w:DisplayVerticalDrawingGridEvery>0</w:DisplayVerticalDrawingGridEvery>
  <w:UseMarginsForDrawingGridOrigin/>
  <w:Compatibility>
   <w:FootnoteLayoutLikeWW8/>
   <w:ShapeLayoutLikeWW8/>
   <w:AlignTablesRowByRow/>
   <w:ForgetLastTabAlignment/>
   <w:LayoutRawTableWidth/>
   <w:LayoutTableRowsApart/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]><object
 classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	color:black;}
h1
	{mso-style-next:Normal;
	margin:0in;
	margin-bottom:.0001pt;
	text-align:justify;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:1;
	font-size:12.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Times New Roman";
	color:black;
	mso-font-kerning:0pt;
	font-weight:normal;
	font-style:italic;}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
	{margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
	{margin:0in;
	margin-bottom:.0001pt;
	text-align:justify;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	color:black;
	mso-bidi-font-weight:bold;}
em
	{mso-bidi-font-style:normal;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
pre
	{margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
	font-size:10.0pt;
	font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";}
tt
	{font-family:"Courier New";
	mso-ascii-font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";
	mso-hansi-font-family:"Courier New";
	mso-bidi-font-family:"Courier New";}
p.Preformatted, li.Preformatted, div.Preformatted
	{mso-style-name:Preformatted;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:none;
	tab-stops:0in 47.95pt 95.9pt 143.85pt 191.8pt 239.75pt 287.7pt 335.65pt 383.6pt 431.55pt 479.5pt;
	layout-grid-mode:char;
	font-size:10.0pt;
	font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";
	mso-bidi-font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
table.MsoTableGrid
	{mso-style-name:"Table Grid";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	border:solid windowtext 1.0pt;
	mso-border-alt:solid windowtext .5pt;
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-border-insideh:.5pt solid windowtext;
	mso-border-insidev:.5pt solid windowtext;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="27650"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head><body style="" lang="EN-US">

<div class="Section1">

<p class="MsoNormal" style="text-align: center;" align="center"><b style=""><span style="font-size: 18pt;">Problem M<o:p></o:p></span></b></p>

<p class="MsoNormal" style="text-align: center;" align="center"><b style=""><span style="font-size: 24pt;">Factorial! You Must be Kidding!!! </span><o:p></o:p></b></p>

<p class="MsoNormal" style="text-align: center;" align="center"><b><span style="">Input: </span></b><span style="">standard input<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: center;" align="center"><b><span style="">Output: </span></b><span style="">standard output<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: center;" align="center"><b><span style="">Time Limit:</span></b><span style=""> 1 second<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: center;" align="center"><b style=""><span style="">Memory Limit: </span></b><span style="">32 MB<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><o:p>&nbsp;</o:p></p>

<p class="MsoNormal" style="text-align: justify;"><o:p>&nbsp;</o:p></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;">Arif
has bought a super computer from Bongobazar. Bongobazar is a place in </span><st1:place><span style="color: windowtext;">Dhaka</span></st1:place><span style="color: windowtext;"> where second hand goods are
found in plenty. So the super computer bought by him is also second hand and
has some bugs. One of the bugs is that the range of unsigned long integer of
this computer for <b style="">C/C++</b> compiler has
changed. Now its new lower limit is <b style="">10000</b>
and upper limit is <b style="">6227020800</b>. Arif
writes a program in <b style="">C/C++</b> which
determines the factorial of an integer. Factorial of an integer is defined
recursively as:<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b style="">Factorial (0) = 1<o:p></o:p></b></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b style="">Factorial (n) = n*factorial
(n-1).<o:p></o:p></b></span></p>

<p class="MsoNormal" style="text-align: justify;"><b style=""><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></b></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;">Of
course one can manipulate these expressions. For example, it can be written as<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b style="">Factorial (n) =n*(n-1)*factorial
(n-2)<o:p></o:p></b></span></p>

<p class="MsoNormal" style="text-align: justify;"><b style=""><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></b></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;">This
definition can also be converted to an iterative one.<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;">But
Arif knows that his program will not behave rightly in the super computer. You
are to write program which will simulate that changed behavior in a Normal
Computer.<span style="">&nbsp; </span><o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal" style=""><b style=""><span style="font-size: 18pt; color: windowtext;">Input<o:p></o:p></span></b></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;">The
input file contains several lines of input. Each line contains a single integer
<b style="">n</b>. No integer has more than six
digits. Input is terminated by end of file.<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal" style=""><b style=""><span style="font-size: 18pt; color: windowtext;">Output<o:p></o:p></span></b></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;">For
each line of input you should output a single line. This line will contain a
single integer <b style="">n!</b> if the value of <b style="">n!</b> fits within the unsigned long
integer of Arif&#8217;s computer. Otherwise the line will contain one of the
following two words<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="color: windowtext;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><b style="">Overflow! //</b>(When n! &gt; 6227020800)<b style=""><o:p></o:p></b></span></p>

<p class="MsoNormal" style="text-align: justify;"><b style=""><span style="color: windowtext;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Underflow! //</span></b><span style="color: windowtext;">(When n! &lt; 10000)<b style=""><o:p></o:p></b></span></p>

<p class="MsoNormal" style="text-align: justify;"><b style=""><span style="color: windowtext;"><o:p>&nbsp;</o:p></span></b></p>

<p class="MsoNormal" style="text-align: justify;"><b style=""><span style="font-size: 18pt;">Sample Input</span><o:p></o:p></b></p>

<p class="MsoNormal" style="text-align: justify;"><span style="font-size: 11pt; font-family: &quot;Courier New&quot;;">2<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="font-size: 11pt; font-family: &quot;Courier New&quot;;">10<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="font-size: 11pt; font-family: &quot;Courier New&quot;;">100<o:p></o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><span style="font-size: 11pt; font-family: &quot;Courier New&quot;;"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal" style="text-align: justify;"><b><span style="font-size: 18pt;">Sample Output</span><o:p></o:p></b></p>

<p class="MsoNormal" style=""><span style="font-size: 11pt; font-family: &quot;Courier New&quot;; color: windowtext;">Underflow!<o:p></o:p></span></p>

<p class="MsoNormal" style=""><span style="font-size: 11pt; font-family: &quot;Courier New&quot;; color: windowtext;">3628800<o:p></o:p></span></p>

<p class="MsoNormal" style=""><span style="font-size: 11pt; font-family: &quot;Courier New&quot;; color: windowtext;">Overflow!<o:p></o:p></span></p>

<div class="MsoNormal" style="text-align: center;" align="center"><span style="color: windowtext;">

<hr align="center" size="2" width="100%">

</span></div>

<p class="MsoNormal" style=""><b style=""><span style="color: windowtext;">(The Decider Contest, Problem setter: Shahriar Manzoor)</span></b><span style="color: windowtext;"><o:p></o:p></span></p>

</div>

</body></html>